package com.lupan.guice.bindings.buildInBuilding;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.lupan.guice.bindings.*;

/**
 * 说明:
 *
 * @author lupan
 * @version 2016/9/27 0027 下午 9:56
 */
public class Main {
    public static void main(String[] args) {
        Injector injector = Guice.createInjector(new AbstractModule() {
            @Override
            protected void configure() {
                bind(TransactionLog.class).to(ConsoleLog.class);
                bind(CreditCardProcessor.class).to(PaypalCreditCardProcessor.class);

            }
        });

        BillingService billingService = injector.getInstance(BillingService.class);

        System.out.println(billingService.getLog().log());
    }
}
